package com.hiep.connect.shared;

import java.io.Serializable;

import java.util.*;
import com.vercer.engine.persist.annotation.Key;

//@Cached
public class MyUser implements Serializable {
	private static final long serialVersionUID = 201204301L;

	@Key
	private String email;
	private String userId;
	private String password;
	private String name;
	private String websiteURL;
	private String photoURL;
	private Date birthDate;
	private Date signUpDate;

	private boolean loggedIn = false;

	private String loginUrl;

	private String logoutUrl;

	private String emailAddress;

	private String nickname;

	private List<MyUser> friends;

	private List<FriendGroup> friendGroups;

	private List<PostingThread> postingThreads;

	private List<MyUser> pendingFriends;

	public List<MyUser> getPendingFriends() {
		return pendingFriends;
	}

	public void setPendingFriends(List<MyUser> pendingFriends) {
		this.pendingFriends = pendingFriends;
	}

	public MyUser() {
	}

	public MyUser(String email) {
		this.email = email;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getWebsiteURL() {
		return websiteURL;
	}

	public void setWebsiteURL(String websiteURL) {
		this.websiteURL = websiteURL;
	}

	public String getPhotoURL() {
		return photoURL;
	}

	public void setPhotoURL(String photoURL) {
		this.photoURL = photoURL;
	}

	public Date getBirthDate() {
		return birthDate;
	}

	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}

	public Date getSignUpDate() {
		return signUpDate;
	}

	public void setSignUpDate(Date signUpDate) {
		this.signUpDate = signUpDate;
	}

	public List<MyUser> getFriends() {
		return friends;
	}

	public void addFriend(MyUser friend) {
		friends.add(friend);
	}

	// TODO a hack for now
	public void addAllFriends(Collection<MyUser> friends) {
		friends.addAll(friends);
	}

	public void addToPendingFriendList(MyUser friend) {
		if (pendingFriends == null) {
			pendingFriends = new ArrayList<MyUser>();
		}
		pendingFriends.add(friend);
	}

	public void setFriends(List<MyUser> friends) {
		this.friends = friends;
	}

	// public List<FriendGroup> getFriendGroups() {
	// return friendGroups;
	// }
	//
	// public void setFriendGroups(List<FriendGroup> friendGroups) {
	// this.friendGroups = friendGroups;
	// }

	public List<PostingThread> getPostingThreads() {
		return postingThreads;
	}

	public void setPostingThreads(List<PostingThread> postingThreads) {
		this.postingThreads = postingThreads;
	}

	public void addPostingThread(PostingThread thread) {
		if (postingThreads == null) {
			postingThreads = new ArrayList<PostingThread>();
		}
		postingThreads.add(thread);
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isLoggedIn() {
		return loggedIn;
	}

	public void setLoggedIn(boolean loggedIn) {
		this.loggedIn = loggedIn;
	}

	public String getLoginUrl() {
		return loginUrl;
	}

	public void setLoginUrl(String loginUrl) {
		this.loginUrl = loginUrl;
	}

	public String getLogoutUrl() {
		return logoutUrl;
	}

	public void setLogoutUrl(String logoutUrl) {
		this.logoutUrl = logoutUrl;
	}

	public String getEmailAddress() {
		return emailAddress;
	}

	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
}
